<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue';
export default {
  data () {
    return {
      cdata: []
    }
  },
  components: {
    Chart,
  },
  mounted () {
    this.getdata();
  },
  methods: {
    async getdata(){
      let self = this;
      this.$http.get('http://116.196.92.193:8090/data/getLeft', {
        params: {
        }
      }).then(function (response) {
        //console.info(response);
        var datas = response.data.data;
        var arr = [];
        for(var key in datas){
          arr.push({name:key,cases:datas[key].split('-')[0],deaths:datas[key].split('-')[1]});
        }
        self.cdata = arr;
      }).catch(function (error) {
        console.log(error);
      });
    },
  }
}
</script>

<style lang="scss" scoped>
</style>
